<%-- 
    Document   : delete
    Created on : 2014/2/24, 下午 04:37:48
    Author     : Gjun
--%>

<%@page import="java.sql.DriverManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
        request.setCharacterEncoding("UTF-8");
        String id = request.getParameter("id");
        String 產品名稱= request.getParameter("產品名稱");
        String 產品價格= request.getParameter("產品價格");
        String 庫存量= request.getParameter("庫存量");
        String 產品介紹= request.getParameter("產品介紹");
        
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        java.sql.Connection con = DriverManager.getConnection("jdbc:sqlserver://10.10.3.14:1433;databaseName=javadb", "javadb", "java");
        java.sql.Statement st = con.createStatement();
        
        String sql="DELETE FROM 產品維護 WHERE id="+id;
        int x=st.executeUpdate(sql);
        //System.out.println("sql:"+sql);
        System.out.println("異動"+x+"筆資料");
        st.close();
        con.close();
    %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%=sql %>
        <h1>已刪除!</h1><br>
        <a href="listdb.jsp">返回清單</a>
    </body>
</html>
